
class AppStorageUtil {
  public static setOrCreate<T>(key: string, value: T): void {
    AppStorage.setOrCreate<T>(key, value);
  }

  public static get<T>(key: string, defaultValue?: T): T {
    let v = AppStorage.get<T>(key);
    if (!v) {
      if (defaultValue) {
        AppStorage.setOrCreate(key, defaultValue);
        return AppStorage.get(key);
      }
      return undefined;
    } else {
      return v;
    }
  }

  public static removeHistory(key: string): void {
    AppStorage.delete(key);
  }

  public static has(key: string): boolean {
    let v = AppStorage.has(key)
    return v;
  }


}

export default AppStorageUtil